#include<iostream>
#include<string>
using namespace std;
typedef long long LL;
const LL mod = 998244353;
string n1, n2;
LL n;
int main()
{
    LL a = 0, b = 0;
    cin >> n;
    cin >> n1 >> n2;
    for (int i = 0; i < n; i++) {
        LL k1 = n1[i] - '0';
        LL k2 = n2[i] - '0';
        // cout<<"k1=="<<k1<<endl;
        // cout<<"k2=="<<k2<<endl;
        if (k1 > k2)swap(k1, k2);
        a = a * 10 + k1;
        b = b * 10 + k2;
        a %= mod;
        b %= mod;
        // cout<<"a=="<<a<<endl;
        // cout<<"b=="<<b<<endl;
    }
    cout << a * b % mod << endl;
    return 0;
}
